macro (SETUP_LINK_LIBRARIES)

   if (TARGET_USE_BOOST)
	##windows provides autolinkage of boost libraries
	if (WIN32)
          #add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
	else (WIN32)
	    set (TARGET_EXT_LINK ${TARGET_EXT_LINK} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
	endif(WIN32)
   endif (TARGET_USE_BOOST)
   
   if (TARGET_USE_OPENCV)
	set (TARGET_EXT_LINK ${TARGET_EXT_LINK} ${OpenCV_LIBRARIES})
   endif (TARGET_USE_OPENCV)

endmacro (SETUP_LINK_LIBRARIES)

macro (SETUP_LIB)
	
	SETUP_LINK_LIBRARIES()	
	
	add_library(${TARGET_NAME} ${LIB_BUILD_CONTROL} ${TARGET_SRC} ${TARGET_HEADER})
   	target_link_libraries (${TARGET_NAME} ${TARGET_INT_LINK} ${TARGET_EXT_LINK})

	if (${TARGET_INT_LINK})
		add_dependencies (${TARGET_NAME} ${TARGET_INT_LINK})
	endif (${TARGET_INT_LINK})

	set_target_properties(${TARGET_NAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL_PREFIX} ${TARGET_NAME}")

endmacro (SETUP_LIB)

macro (SETUP_CONSOLE_APP)
   
	SETUP_LINK_LIBRARIES()
   
	add_executable(${TARGET_NAME} ${TARGET_SRC} ${TARGET_HEADER})

	target_link_libraries (${TARGET_NAME} ${TARGET_INT_LINK} ${TARGET_EXT_LINK})
   	if (${TARGET_INT_LINK})
   		add_dependencies (${TARGET_NAME} ${TARGET_INT_LINK})
   	endif(${TARGET_INT_LINK})

   	set_target_properties(${TARGET_NAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL_PREFIX} ${TARGET_NAME}")

endmacro (SETUP_CONSOLE_APP)

macro (SETUP_GUI_APP)
   
   	SETUP_LINK_LIBRARIES()
   
   	add_definitions(${wxWidgets_DEFINITIONS})
   	
	#include(${wxWidgets_USE_FILE})

	if(WIN32)
		set(PLATFORM_SPECIFIC_CONTROL WIN32)
	endif(WIN32)

	add_executable(${TARGET_NAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_HEADER})
   
	target_link_libraries (${TARGET_NAME} ${TARGET_INT_LINK} ${TARGET_EXT_LINK} ${wxWidgets_LIBRARIES} )

	set_target_properties(${TARGET_NAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL_PREFIX} ${TARGET_NAME}")
endmacro (SETUP_GUI_APP)
